import 'package:flutter/material.dart';
import '../MyFont.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Namer App',
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(
            seedColor: const Color.fromARGB(255, 221, 49, 141)),
      ),
      home: Scaffold(
        appBar: AppBar(
          title: const Text(
            '麦麦的巴巴',
            style: TextStyle(
              color: Color.fromARGB(255, 255, 151, 208),
              fontSize: 24,
            ),
          ),
          backgroundColor: Theme.of(context).colorScheme.primary,
        ),
        body: const MyBody(),
      ),
    );
  }
}

class MyBody extends StatelessWidget {
  const MyBody({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Theme.of(context).colorScheme.primaryContainer,
      child: Center(
        child: const Column(
          children: [
            // FirstMeet(),
            // SurpriseButton(),
            // WelcomeBox(),
            // MyImage(),
            // CircleImage(),
            // ClipImage(),
            LocalImage(),
            // PressMe(),
            ImageInfo(),
          ],
        ),
      ),
    );
  }
}

class FirstMeet extends StatelessWidget {
  const FirstMeet({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        alignment: Alignment.center,
        width: 300,
        height: 100,
        margin: const EdgeInsets.fromLTRB(0, 20, 0, 20),
        decoration: BoxDecoration(
          color: Colors.red,
          shape: BoxShape.rectangle,
          border: Border.all(
            color: const Color.fromARGB(255, 155, 233, 166),
            width: 30,
          ),
          borderRadius: BorderRadius.circular(30),
          boxShadow: const [
            BoxShadow(
              color: Color.fromARGB(255, 150, 59, 255),
              blurRadius: 50,
            )
          ],
          gradient: const RadialGradient(
            colors: [
              Colors.red,
              Colors.blue,
              Colors.yellow,
            ],
          ),
        ),
        child: const Text(
          'hello flutter\nbye flutter',
          textAlign: TextAlign.start,
          textDirection: TextDirection.ltr,
          style: TextStyle(
            color: Color.fromARGB(255, 255, 151, 208),
            fontSize: 30,
          ),
        ),
      ),
    );
  }
}

class SurpriseButton extends StatelessWidget {
  const SurpriseButton({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
        alignment: Alignment.centerLeft,
        height: 100,
        width: 180,
        margin: const EdgeInsets.all(20),
        padding: const EdgeInsets.all(10),
        // transform: Matrix4.translationValues(10, 10, 10), // 位移
        // transform: Matrix4.rotationZ(-0.4),    // 旋转
        transform: Matrix4.skewY(-0.1), // 倾斜
        decoration: const BoxDecoration(
          color: Colors.black,
          borderRadius: BorderRadius.horizontal(
            left: Radius.circular(10),
            right: Radius.circular(50),
          ),
        ),
        child: ElevatedButton(
          onPressed: () => {print('you beat me!')},
          child: const Text(
            '点击有惊喜',
            style: TextStyle(
              color: Colors.pink,
              fontSize: 16,
            ),
          ),
        ));
  }
}

class WelcomeBox extends StatelessWidget {
  const WelcomeBox({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.topCenter,
      width: 200,
      height: 100,
      margin: const EdgeInsets.fromLTRB(0, 20, 0, 20),
      padding: const EdgeInsets.all(10),
      decoration: const BoxDecoration(
        color: Color.fromARGB(255, 250, 143, 223),
        borderRadius: BorderRadius.all(Radius.circular(10)),
      ),
      child: const Text(
        'hello flutter again, welcome to tx\'s home, I prepared some fruits and cats here for you guys to play',
        style: TextStyle(
          color: Color.fromARGB(255, 129, 22, 216),
          fontSize: 18,
          fontStyle: FontStyle.italic,
        ),
        textAlign: TextAlign.left,
        softWrap: true,
        maxLines: 3,
        overflow: TextOverflow.fade,
      ),
    );
  }
}

class MyImage extends StatelessWidget {
  const MyImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        height: 100,
        width: 100,
        margin: const EdgeInsets.fromLTRB(0, 10, 0, 10),
        decoration: const BoxDecoration(
          color: Colors.purple,
        ),
        child: Image.network(
          "https://www.itying.com/themes/itying/images/ionic4.png",
          alignment: Alignment.centerLeft,
          fit: BoxFit.fill,
          repeat: ImageRepeat.repeat,
        ),
      ),
    );
  }
}

/// 圆形图片
class CircleImage extends StatelessWidget {
  const CircleImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100,
      width: 100,
      margin: const EdgeInsets.fromLTRB(0, 10, 0, 10),
      decoration: BoxDecoration(
        color: Colors.yellow,
        borderRadius: BorderRadius.circular(50),
        image: const DecorationImage(
          image: NetworkImage(
              "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png"),
          fit: BoxFit.contain,
        ),
      ),
    );
  }
}

/// 圆形图片
class ClipImage extends StatelessWidget {
  const ClipImage({super.key});

  @override
  Widget build(BuildContext context) {
    return ClipOval(
      child: Image.network(
        "https://k.sinaimg.cn/n/sinakd20117/0/w800h800/20240127/889b-4c8a7876ebe98e4d619cdaf43fceea7c.jpg/w700d1q75cms.jpg",
        width: 150,
        height: 150,
      ),
    );
  }
}

/// 本地图片
class LocalImage extends StatelessWidget {
  const LocalImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 600,
      width: 400,
      margin: const EdgeInsets.fromLTRB(0, 10, 0, 10),
      child: Image.asset(
        "images/2.0x/热巴1.jpg",
        fit: BoxFit.cover,
      ),
    );
  }
}

/// 图标库：https://www.iconfont.cn/
class PressMe extends StatelessWidget {
  const PressMe({super.key});

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            Icon(
              MyFont.pikachu,
              size: 50,
              color: Color.fromARGB(255, 255, 212, 0),
            ),
            Icon(
              MyFont.psyduck,
              size: 50,
              color: Color.fromARGB(255, 255, 216, 0),
            ),
            Icon(
              MyFont.squirtle,
              size: 50,
              color: Color.fromARGB(255, 127, 229, 216),
            ),
          ],
        ),
        SizedBox(
          height: 20,
        ),
        Icon(
          MyFont.pokemonBall,
          size: 100,
          color: Color.fromARGB(255, 255, 0, 0),
        ),
      ],
    );
  }
}

class ImageInfo extends StatelessWidget {
  const ImageInfo({super.key});

  @override
  Widget build(BuildContext context) {
    return Expanded(
      child: ListView(
        children: const <Widget>[
          ListTile(
            leading: Icon(Icons.girl),
            title: Text("不要害怕遗憾，因为机遇就在你后面。"),
            trailing: Text("——迪丽热巴"),
          ),
          Divider(),
          ListTile(
            title: Text("我是迪丽热巴。 我就是自己的战士，我值得拥有。"),
            subtitle: Text("啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊"),
          ),
          Divider(),
          ListTile(
            title: Text("因为有了黑夜，星星才会如此闪耀。经历过黑暗时，才能活成一束光。"),
          ),
          Divider(),
          ListTile(
            title: Text(
                "如果遇到自己想做的事情，那就勇敢去做吧，大胆的去付出吧。很多时候，我们缺少不是想法，不是能力，而是那份果断和勇敢。"),
          ),
          Divider(),
          ListTile(
            title: Text("勇敢去追，大胆去付出，如果你遇到了自己想做的事情，那就勇敢去做吧！真诚地做你自己，不要害怕。"),
          ),
          Divider(),
          ListTile(
            title: Text("在这个世界上，没有人可以给我们贴上标签，只有我们自己可以定义自己。"),
          ),
          Divider(),
          ListTile(
            title: Text("永远都不为自己选择的道路而后悔,不管是十年前,还是现在。因为唯一能做的,只是义无反顾地走下去"),
          ),
          Divider(),
          ListTile(
            title: Text(
                "我现在也不觉得自己有多幸运，因为这一路走来，我都记得自己非常清晰的脚步，怎么一步一步，能够到今天，可以有自己喜欢的角色、可以有这么好的机会。其实幸运还是要靠自己去争取的，不是说我坐在这里就肯定有好事来找我。所以我觉得我不幸运，但是一定会自己去创造幸运的。"),
          ),
        ],
      ),
    );
  }
}
